package org.esk.dablog.dao.hibernate;

import org.esk.dablog.dao.PictureDAO;
import org.esk.dablog.model.Picture;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

/**
 * This class implements Picture DAO
 * User: jc
 * Date: 30.11.2006
 * Time: 12:53:32
 * $Id:$
 */
public class PictureDAOImpl extends HibernateDaoSupport implements PictureDAO {

    /**
     * returns picture by id
     * @param id
     * @return
     */
    public Picture getPicture(long id) {
        return (Picture) getHibernateTemplate().get(Picture.class, id);
    }

    /*
     * deletes picture
     */
    public void deletePicture(long id) {
        getHibernateTemplate().bulkUpdate("delete " + Picture.class.getName() +
                " p where p.id = ?", id);
    }

}
